Change in openvpn[master]: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
A message that is not in the archive (sent off-list or not yet received): gerrit.1772798203000.Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
to review the following change.
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
---
M src/openvpn/dns.c
1 file changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1558/1
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (!j) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%d" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File src/openvpn/dns.c:
http://gerrit.openvpn.net/c/openvpn/+/1558/comment/fccde101_7d7bf6c3?usp=email :
PS2, Line 487: if (!j)
technically this is fine, but it takes me as a reader few more seconds to understand what this check does - I would prefer if (j == 0) here.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 12 Mar 2026 08:03:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello cron2, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
---
M src/openvpn/dns.c
1 file changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1558/3
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%d" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: cron2, plaisthos.
flichtenheld has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/dns.c:
http://gerrit.openvpn.net/c/openvpn/+/1558/comment/afed0dee_70196530?usp=email :
PS2, Line 487: if (!j)
Quoted 1 line
technically this is fine, but it takes me as a reader few more seconds to understand what this check […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Thu, 12 Mar 2026 13:26:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 12 Mar 2026 16:41:17 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v3 1/1 dns: Change arguments to setenv_dns_option to avoid sign-compare warning
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%d" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
The change is no longer submittable: Code-Review is unsatisfied now.
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
Patch Set 3: Code-Review-1
(1 comment)
Patchset:
PS3:
I withdraw my +2 for the time being, because I do not understand why this is needed in the first place - also, the *new* code brings "dns_server_%zu_resolve_domain_%d", i, j which can't be right (second %d)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 14 Mar 2026 17:16:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello cron2, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
---
M src/openvpn/dns.c
1 file changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1558/4
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%zu" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
Patch Set 7: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 07 Apr 2026 09:46:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v7 1/1 dns: Change arguments to setenv_dns_option to avoid sign-compare warning
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
This mail reflects revision 7 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%zu" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
[Openvpn-devel] [PATCH applied] Re: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
I was not exactly eager to apply this, because it changes so many lines, and I foresee a patch to this code coming up "for master and 2.7" which will then create havoc on merging... but maybe I'm just a pessimist.
Whatever, this code is fine (in the revised %zu version), and gets rid of a few #ifdef/#pragmas, so moving ahead... compile tested on linux (as this is !WIN32).
Your patch has been applied to the master branch.
commit 7f870c0753eccece035f682f8ae43f082e9af805
Author: Frank Lichtenheld Date: Tue Apr 7 11:46:37 2026 +0200
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36531.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#8) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36531.html
---
M src/openvpn/dns.c
1 file changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/1558/8
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%zu" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email )
Change subject: dns: Change arguments to setenv_dns_option to avoid sign-compare warning
......................................................................
dns: Change arguments to setenv_dns_option to avoid sign-compare warning
The change is a bit big to fix just one compare warning, but that is due to the highly interdependent code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1558
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36531.html
---
M src/openvpn/dns.c
1 file changed, 12 insertions(+), 21 deletions(-)
src/openvpn/dns.c +12 -21
@@ -476,20 +476,15 @@ send_msg_iservice(o->msg_channel, &nrpt, sizeof(nrpt), &ack, "DNS"); } -#else /* ifdef _WIN32 */ - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif +#else /* ifdef _WIN32 */ static void -setenv_dns_option (struct env_set *es,const char *format,int i,int j,const char *value) +setenv_dns_option (struct env_set *es,const char *format,size_t i,size_t j,const char *value) {char name[64 ];bool name_ok = false; -if (j <0 ) +if (j ==0 ) { name_ok =checked_snprintf (name,sizeof (name), format, i); }
@@ -512,11 +507,11 @@struct gc_arena gc =gc_new ();const struct dns_server *s;const struct dns_domain *d; -int i, j; +size_t i, j;for (i =1 , d = o->search_domains; d !=NULL ; i++, d = d->next) { -setenv_dns_option (es,"dns_search_domain_%d" , i,-1 , d->name); +setenv_dns_option (es,"dns_search_domain_%zu" , i,0 , d->name); }for (i =1 , s = o->servers; s !=NULL ; i++, s = s->next)
@@ -525,17 +520,17 @@ {if (s->addr[j].family ==AF_INET ) { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in_addr_t (s->addr[j].in.a4.s_addr,IA_NET_ORDER , &gc)); }else { -setenv_dns_option (es,"dns_server_%d_address_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_address_%zu" , i, j +1 ,print_in6_addr (s->addr[j].in.a6,0 , &gc)); }if (s->addr[j].port) { -setenv_dns_option (es,"dns_server_%d_port_%d" , i, j +1 , +setenv_dns_option (es,"dns_server_%zu_port_%zu" , i, j +1 ,print_in_port_t (s->addr[j].port, &gc)); } }
@@ -544,32 +539,28 @@ {for (j =1 , d = s->domains; d !=NULL ; j++, d = d->next) { -setenv_dns_option (es,"dns_server_%d_resolve_domain_%d" , i, j, d->name); +setenv_dns_option (es,"dns_server_%zu_resolve_domain_%zu" , i, j, d->name); } }if (s->dnssec) { -setenv_dns_option (es,"dns_server_%d_dnssec" , i,-1 ,dnssec_value (s->dnssec)); +setenv_dns_option (es,"dns_server_%zu_dnssec" , i,0 ,dnssec_value (s->dnssec)); }if (s->transport) { -setenv_dns_option (es,"dns_server_%d_transport" , i,-1 ,transport_value (s->transport)); +setenv_dns_option (es,"dns_server_%zu_transport" , i,0 ,transport_value (s->transport)); }if (s->sni) { -setenv_dns_option (es,"dns_server_%d_sni" , i,-1 , s->sni); +setenv_dns_option (es,"dns_server_%zu_sni" , i,0 , s->sni); } }gc_free (&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static void updown_env_set (bool up,const struct dns_options *o,const struct tuntap *tt,struct env_set *es) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1558?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcc350c772227cfc0f2244fa2b1625dcb7e6fb5
Gerrit-Change-Number: 1558
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>